Skip to content

Comments

feat: add background update check and self-update command#91

Open
pat-s wants to merge 4 commits intomainfrom
feat/self-update
Open

feat: add background update check and self-update command#91
pat-s wants to merge 4 commits intomainfrom
feat/self-update

Conversation

@pat-s
Copy link
Member

@pat-s pat-s commented Feb 20, 2026

@JosiahParry The main goal here is to make it easier for Windows/Linux users to update the CLI without having to search for the install command again.

With normal access to GH, this should just work OOB via ricochet self-update.
For systems without outbound access, a smart detection feature is included that stops these checks after a specific time as they are meaningless anyway.

Summary

  • Add ricochet self-update command that downloads and replaces the running binary with the latest GitHub release
  • Add periodic background update check (every 24h) that notifies users via stderr when a new version is available
  • Auto-disable update checks after 3 consecutive GitHub API failures, with a transparent notice to the user and a skip_update_check config flag
  • Support all platforms: macOS downloads from S3 (bottle format), Linux/Windows from GitHub Releases
  • Skip checks automatically for Homebrew installs (/opt/homebrew/bin) and when RICOCHET_NO_UPDATE_CHECK is set
  • ricochet self-update re-enables checks if they were auto-disabled, resets failure counter, and shows release notes link

The install script now defaults to ~/.local/bin instead of /usr/local/bin
when running as a non-privileged user, avoiding the need for sudo.
The sudo fallback has been removed; if the target directory is not
writable, the script errors with a clear message instead.

The PATH check and warning are now shown on all platforms, not just
Windows.

When RICOCHET_INSTALL_DIR is set, that value is still respected. When
running as root, /usr/local/bin is still the default.

Closes #86
Add a periodic background update check that queries the GitHub Releases API every 24 hours and notifies the user via stderr when a new version is available. Add a `ricochet self-update` command that downloads and replaces the running binary with the latest release.

Key behaviors:
- Background check runs on all platforms; skipped for Homebrew installs (/opt/homebrew) and when RICOCHET_NO_UPDATE_CHECK is set
- After 3 consecutive GitHub API failures, update checks are automatically disabled via skip_update_check in config.toml, with a stderr notice explaining the change
- `ricochet self-update` re-enables checks if they were auto-disabled
- Uses self-replace crate for cross-platform atomic binary replacement (handles Windows file locking)
- macOS downloads from S3 (Homebrew bottle format), Linux/Windows from GitHub Releases
- Release notes link shown after updating
@pat-s pat-s requested a review from JosiahParry February 23, 2026 16:36
@pat-s
Copy link
Member Author

pat-s commented Feb 23, 2026

@JosiahParry Would be cool to get this into 0.4.0 so users can start with that feature right away instead of having to download another static version that ship with that - but I am also OK to postpone it to the next version.

I just would like to release a new version with the auth fixes latest tomorrow :)

@JosiahParry
Copy link
Member

I agree—but I’ve got some hesitation with the version checks not using semver and the const for max checks since IIUC (and very may well not) the binary is invoked fresh each command so that will never exceed 1. I’m just lacking bandwidth to give it the full review atm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants